
/**
 * Module dependencies.
 */

var express = require('express');
var routes = require('./routes')
  , http = require('http')
  , path = require('path');


var initData = require('./models/InitData');
GLOBAL.site = 'mg02'
GLOBAL.model=initData.initAll();


var app = express();

app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', 'sites/'+GLOBAL.site+ '/views');
  app.set('view engine', 'ejs');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
//  app.use(express.static('sites/'+GLOBAL.site+'/public'));
});

app.configure('development', function(){
  app.use(express.errorHandler());
});

app.get('/img/*', routes.static);
app.get('/scripts/*', routes.static);
app.get('/css.css', routes.static);
app.get('/', routes.index);
app.get('/index.html', routes.index);
app.get('/index-:page.html', routes.index);
app.get('/about.html', routes.about);
app.get('/:country_name', routes.country);
app.get('/:country_name/:city_name', routes.city);
app.get('/:country_name/:city_name/:department_name', routes.department);

http.createServer(app).listen(app.get('port'), function(){
  console.log("Express server listening on port " + app.get('port'));
});
